home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #054 (1990)(Amiga User Group Deutschland e.V.).zip / Franz PD Disk #054 (1990)(Amiga User Group Deutschland e.V.).adf / EW / ew.asm < prev    next >
Assembly Source File  |  1989-07-02  |  6KB  |  347 lines

  1. *
  2. * EW.asm
  3. *
  4. * creates a "exploding window"-effect
  5. * by patching Int's "OpenWindow()" and "CloseWindow()"
  6. *
  7. * based on a 10k C-program by (someone)?
  8. *
  9. * this one for a68k is a *little* bit shorter
  10. * and xxxxxx  ("better" removed due to some problems...)
  11. *
  12. * written & no © 1989 by Olli
  13. *
  14. * a68k ew.asm
  15. * blink ew.o SC SD ND
  16. *
  17. * have fun, use in whatever you want...
  18. * it would be nice if you were so kind to always
  19. * remember who has developed this original code
  20. * during many hard nights...
  21. *
  22. * simply type "1> ew" from CLI or double-click from WB
  23. * no need to RUN, no need to lie...
  24. *
  25. *
  26. * direct comments, contributions, ... to
  27. *
  28. * Oliver Wagner
  29. * Landsberge 5
  30. * 4322 Sprockhövel
  31. * West Germany
  32. *
  33. * no email (I'm not that rich)
  34. *
  35. * 28.10.89: first midnight try
  36. * 29.10.89: sorry, use of "Forbid()" seems to be necessary
  37. * 30.10.89: a second call will remove it
  38. * 30.10.89: nasty-pixel-bug fixed: use Move() instead of
  39. *        directly writing to cp_x, cp_y (sigh)
  40. *        Move() seems to recalc some more rp-values...
  41. * 31.10.89: startup-msg
  42. * 31.10.89: finally, wb-bug fixed: you may NOT use DOS until
  43. *        you received the WBStartup-Msg because DOS will
  44. *        think the WBMsg is a file-packet...Guru!
  45. *        solution: not using Exit(), but receive msg by hand...
  46.  
  47.     section "satisfaction",code
  48.  
  49.     move.l    4,a6
  50.     lea    intname(pc),a1
  51.     lea    intbase(pc),a5
  52.     jsr    -408(a6)
  53.     move.l    d0,(a5)
  54.     move.l    d0,a0
  55.     move.l    -202(a0),d0
  56.     cmp.l    #$f80000,d0        * already installed?
  57.     bge.s    noinmem
  58.     move.l    d0,a1
  59.     move.l    -8(a1),-202(a0)     * repatch Int
  60.     move.l    -4(a1),-70(a0)
  61.     move.l    #end-begin,d0
  62.     moveq    #newopen-begin,d1
  63.     sub.l    d1,a1
  64.     jsr    -210(a6)            * free patch
  65.     lea    emsg1(pc),a3
  66.     moveq    #emsg2-emsg1,d6
  67.     bra.s    quit
  68. noinmem:
  69.     lea    gfxname(pc),a1
  70.     jsr    -408(a6)
  71.     move.l    d0,4(a5)
  72.     lea    begin(pc),a4
  73.     lea    end(pc),a1
  74.     sub.l    a4,a1
  75.     move.l    a1,d0
  76.     moveq    #0,d1
  77.     move.l    d0,d7
  78.     jsr    -198(a6)              * allocpatch
  79.     move.l    d0,a5
  80.     move.l    d0,a1
  81.     move.l    a4,a0
  82.     move.l    d7,d0
  83.     jsr    -624(a6)
  84.     jsr    (a5)                  * call patchinstall
  85.     lea    emsg(pc),a3
  86.     moveq    #emsg1-emsg,d6
  87. quit:
  88.     moveq    #0,d4
  89.     move.l    4,a6
  90.     lea    dosname(pc),a1
  91.     jsr    -408(a6)
  92.     move.l    d0,a6
  93.     move.l    d0,a2
  94.     jsr    -60(a6)
  95.     move.l    d0,d7
  96.     moveq    #0,d5
  97.     move.l    d7,d1
  98.     bne.s    nowb
  99.     move.l    4,a6
  100.     move.l    $114(a6),a1             * get that old msg
  101.     lea    $5c(a1),a0
  102.     jsr    -384(a6)
  103.     jsr    -372(a6)
  104.     move.l    d0,d4
  105.     lea    conn(pc),a1
  106.     move.l    a1,d1
  107.     move.l    #1006,d2
  108.     move.l    a2,a6
  109.     jsr    -30(a6)
  110.     move.l    d0,d5
  111.     move.l    d0,d1
  112.     beq.s    ret
  113.     move.l    d0,d7
  114. nowb:
  115.     lea    msg(pc),a0
  116.     move.l    a0,d2
  117.     moveq    #emsg-msg,d3
  118.     jsr    -48(a6)
  119.     move.l    d6,d3
  120.     move.l    d7,d1
  121.     move.l    a3,d2
  122.     jsr    -48(a6)
  123. ret:
  124.     tst.l    d5
  125.     beq.s    goodbye
  126.     moveq    #127,d1
  127.     jsr    -198(a6)
  128.     move.l    d5,d1
  129.     jsr    -36(a6)
  130.  
  131. goodbye:
  132.     tst.l    d4
  133.     beq.s    nomsg
  134.     move.l    4,a6
  135.     jsr    -132(a6)
  136.     move.l    d4,a1
  137.     jsr    -378(a6)
  138. nomsg:
  139.     moveq    #0,d0
  140.     rts
  141. conn:
  142.     dc.b    "con:100/60/166/61/EW by Ølli",0
  143. intname:
  144.     dc.b    "intuition.library",0
  145. gfxname:
  146.     dc.b    "graphics.library",0
  147. dosname:
  148.     dc.b    "dos.library",0
  149. msg:
  150.     dc.b    10,$9b,"1;3;33m EXPLODING WINDOWS",10
  151.     dc.b    $9b,"0m by Ølli 1989",10," just "
  152. emsg:
  153.     dc.b    "installed...",10,10
  154. emsg1:
  155.     dc.b    "removed...",10,10
  156. emsg2:
  157.     even
  158.  
  159. * beginning of patch (rest of prog will be freed)
  160.  
  161. * patch Int's vectors
  162.  
  163. begin:
  164.     move.l    intbase(pc),a0
  165.     lea    oldopen(pc),a1
  166.     lea    newopen(pc),a2
  167.     move.l    -202(a0),(a1)
  168.     move.l    a2,-202(a0)
  169.     lea    oldclose(pc),a1
  170.     lea    newclose(pc),a2
  171.     move.l    -70(a0),(a1)
  172.     move.l    a2,-70(a0)
  173.     rts
  174. oldopen:
  175.     dc.l    'Olli'   * sorry, couldn't resist
  176. oldclose:
  177.     dc.l    '1989'
  178.  
  179. * the new "OpenWindow()"
  180.  
  181. newopen:
  182.     movem.l a0/a2-a6/d2-d7,-(sp)
  183.     move.l    a0,a4
  184.     move.l    30(a4),d0
  185.     bne.s    foundscreen
  186.     jsr    -210(a6)
  187. foundscreen:
  188.     move.l    d0,a5
  189.     lea    $54(a5),a5          * get Rastport
  190.     move.b    $1c(a5),d0          * old drawmode
  191.     move.l    d0,a3
  192.     move.l    4,a6
  193.     jsr    -132(a6)            * Forbid() [sorry]
  194.     move.l    gfxbase(pc),a6
  195.     move.l    a5,a1
  196.     moveq    #2,d0
  197.     jsr    -354(a6) ; SetDrMd
  198.  
  199.     moveq    #0,d4
  200.     moveq    #0,d5
  201.     move.w    4(a4),d4
  202.     move.w    6(a4),d5
  203.     asr.w    #1,d4
  204.     asr.w    #1,d5
  205.     add.w    (a4),d4
  206.     add.w    2(a4),d5
  207.     move.w    4(a4),d2
  208.     move.w    6(a4),d3
  209.     asr.w    #3,d2
  210.     asr.w    #2,d3
  211.     subq.w    #1,d2
  212.     subq.w    #1,d3
  213.  
  214.     move.l    d4,d6
  215.     subq.w    #1,d4
  216.     move.l    d5,d7
  217.     subq.w    #1,d5
  218.  
  219.     movem.w d2-d7,-(sp)
  220.     bsr.s    loop1
  221.     movem.w (sp)+,d2-d7
  222.     bsr.s    loop1
  223.  
  224.     move.l    a3,d0
  225.     ext.w    d0
  226.     move.l    a5,a1
  227.     jsr    -354(a6)
  228.     move.l    4,a6
  229.     jsr    -138(a6)
  230.     movem.l (sp)+,a0/a2-a6/d2-d7
  231.     move.l    oldopen(pc),a1
  232.     jmp    (a1)
  233.  
  234. loop1:
  235.     bsr.s    drawframe
  236.     tst.w    d2
  237.     beq.s    loop1a
  238.     subq.w    #4,d4
  239.     addq.w    #4,d6
  240.     subq.w    #1,d2
  241. loop1a:
  242.     tst.w    d3
  243.     beq.s    loop1b
  244.     subq.w    #2,d5
  245.     addq.w    #2,d7
  246.     subq.w    #1,d3
  247. loop1b:
  248.     tst.w    d2
  249.     bne.s    loop1
  250.     tst.w    d3
  251.     bne.s    loop1
  252.     rts
  253.  
  254. * draws a frame
  255.  
  256. drawframe:
  257.     move.w    d4,d0
  258.     move.w    d5,d1
  259.     move.l    a5,a1
  260.     jsr    -240(a6)        * Move() fixed due to nasty pixel bug
  261.     move.l    a5,a1
  262.     move.w    d6,d0
  263.     move.w    d5,d1
  264.     jsr    -246(a6)
  265.     move.w    d6,d0
  266.     move.w    d7,d1
  267.     move.l    a5,a1
  268.     jsr    -246(a6)
  269.     move.w    d4,d0
  270.     move.w    d7,d1
  271.     move.l    a5,a1
  272.     jsr    -246(a6)
  273.     move.w    d4,d0
  274.     move.w    d5,d1
  275.     move.l    a5,a1
  276.     jmp    -246(a6)
  277.  
  278. * the new close routine
  279.  
  280. newclose:
  281.     movem.l a0/a2-a6/d2-d7,-(sp)
  282.     move.l    46(a0),a5
  283.     lea    $54(a5),a5
  284.     move.b    $1c(a5),d0          * save old rp-style
  285.     move.l    d0,a3
  286.     moveq    #0,d4
  287.     moveq    #0,d5
  288.     move.w    4(a0),d4
  289.     move.w    6(a0),d5
  290.     move.l    d4,d6
  291.     move.l    d5,d7
  292.     add.w    8(a0),d6
  293.     add.w    10(a0),d7
  294.     move.w    8(a0),d2
  295.     move.w    10(a0),d3
  296.     asr.w    #3,d2
  297.     asr.w    #2,d3
  298.     subq.w    #1,d2
  299.     subq.w    #1,d3
  300.     move.l    oldclose(pc),a1
  301.     jsr    (a1)
  302.     move.l    4,a6
  303.     jsr    -132(a6)
  304.     move.l    gfxbase(pc),a6
  305.     moveq    #2,d0
  306.     move.l    a5,a1
  307.     jsr    -354(a6)
  308.     movem.w d2-d7,-(sp)
  309.     bsr.s    loop2
  310.     movem.w (sp)+,d2-d7
  311.     bsr.s    loop2
  312.     move.l    a3,d0
  313.     ext.w    d0
  314.     move.l    a5,a1
  315.     jsr    -354(a6)
  316.     move.l    4,a6
  317.     jsr    -138(a6)
  318.     movem.l (sp)+,a0/a2-a6/d2-d7
  319.     rts
  320.  
  321. loop2:
  322.     bsr    drawframe
  323.     tst.w    d2
  324.     beq.s    loop2a
  325.     addq.w    #4,d4
  326.     subq.w    #4,d6
  327.     subq.w    #1,d2
  328. loop2a:
  329.     tst.w    d3
  330.     beq.s    loop2b
  331.     addq.w    #2,d5
  332.     subq.w    #2,d7
  333.     subq.w    #1,d3
  334. loop2b:
  335.     tst.w    d2
  336.     bne.s    loop2
  337.     tst.w    d3
  338.     bne.s    loop2
  339.     rts
  340.  
  341. intbase:
  342.     dc.l    'Olli'
  343. gfxbase:
  344.     dc.l    '1989'
  345. end:
  346.     END
  347.